package com.atguigu.gulimail.product.entity;

import com.atguigu.common.valid.AddGroup;
import com.atguigu.common.valid.ListValue;
import com.atguigu.common.valid.UpdateGroup;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author xujiale
 * @email 2519970360@qq.com
 * @date 2023-10-24 15:34:13
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@NotNull(message = "修改必须指定品牌Id",groups = {UpdateGroup.class})
	@Null(message="新增不能指定品牌Id",groups = {AddGroup.class})
	@TableId
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotEmpty(message = "品牌名不能为空",groups = {UpdateGroup.class,AddGroup.class})  //表示至少包含一个非空格字符
	private String name;
	/**
	 * 品牌logo地址
	 */
//	@URL(message = "logo必须是一个合法的url地址",groups ={UpdateGroup.class,AddGroup.class} )
//	@NotEmpty(message = "logo不能为空" ,groups ={AddGroup.class} )
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@ListValue(value = {1,0},groups = {UpdateGroup.class,AddGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotEmpty(message = "首字母不能为空" ,groups ={AddGroup.class} )
	@Pattern(regexp = "^[a-zA-Z]$",message = "必须为a-z或者A-Z之间的一个字母",groups ={UpdateGroup.class,AddGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(message = "排序字段不能为空" ,groups ={AddGroup.class} )
	@Min(value = 0,message = "排序必须大于等于0",groups ={UpdateGroup.class,AddGroup.class})
	private Integer sort;

}
